import React from 'react';
import * as FileIcons from 'file-icons-js';
import 'file-icons-js/css/style.css';
import './index.scss';

export default class FileIcon extends React.Component {
  render() {
    const { fileName, className, ...others } = this.props;

    const curClassName = FileIcons.getClassWithColor(fileName);
    const textClassName = FileIcons.getClassWithColor('demo.text');
    return (
      <span
        className={`${className} ${curClassName || textClassName} file-name-icon`}
        {...others}
      />
    );
  }
}
